package org.quadraspace.model;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.OneToOne;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlTransient;
import javax.xml.bind.annotation.XmlType;

@XmlType(propOrder= {"id","context","type","model","vendor","data"})
@Entity
public class Sensor {

	@Id
	@GeneratedValue
	private Long theId;
	
	@XmlTransient
	public Long getTheId() {
		return theId;
	}
	public void setTheId(Long theId) {
		this.theId = theId;
	}
	private String id;
	public static enum Context { DEVICE, USER, AMBIENT};
	private Context context = Context.USER;
	private String type;
	private String model;
	private String vendor;
	@XmlAttribute
	public String getId() {
		return id;
	}
	public void setId(String id) {
		this.id = id;
	}
	@XmlAttribute
	public Context getContext() {
		return context;
	}
	public void setContext(Context context) {
		this.context = context;
	}
	@XmlAttribute
	public String getType() {
		return type;
	}
	public void setType(String type) {
		this.type = type;
	}
	@XmlElement
	public String getModel() {
		return model;
	}
	public void setModel(String model) {
		this.model = model;
	}
	@XmlElement
	public String getVendor() {
		return vendor;
	}
	public void setVendor(String vendor) {
		this.vendor = vendor;
	}
	
	@OneToOne(cascade=CascadeType.ALL,fetch=FetchType.EAGER)
	private Data data = new Data();
	@XmlElement
	public Data getData() {
		return data;
	}
	
	public void setData(Data data) {
		this.data = data;
	}
}
